package Authorization;

import Xml.DOMUsersParser;

import java.io.IOException;
import java.util.Scanner;


/**
 * Created with IntelliJ IDEA.
 * Authorization.User: Инесса
 * Date: 26.10.13
 * Time: 15:46
 * To change this template use File | Settings | File Templates.
 */
public class UserController {
    private UserStorage userStorage;


    /**
     * Инициализируем хранилище пользователей в конструкторе класса
     *
     * @throws IOException
     */
    public UserController() {
        this.userStorage = new DOMUsersParser().getUserStorage();
    }


    public boolean hasSuccessfullyLogged(User userToCheck) {
        return userStorage.isUserValid(userToCheck);
    }

    public boolean isAlreadyLoginExists(String login) {
        return userStorage.isUserExist(login);
    }

    public void createNewUser(User user) {
        this.userStorage.createUser(user);
    }

    public String getAdminInfo(User user){
      return this.userStorage.getAdminInfo(user);
    }

}
